<?php
/**
 * 
 * 更新用户教育信息
 * @author yangchao
 * @since 2012-03-19
 */
if (!file_exists("../SINASRV_CONFIG")) {
	echo "Read the sinasrv config error!\n";
//	exit();
} else {
   $array_config = parse_ini_file("../SINASRV_CONFIG", true); var_dump($array_config);
   
   $_SERVER = array_merge($_SERVER, $array_config); 
}


/*ini_set("display_errors",ture);
error_reporting(E_ALL);*/

define("CRON_NAME","update_search_mblog_count");//cro名称，要求唯一
set_time_limit(0);
$_GET["db_debug"] = true;
$_GET["no_pref_debug"] = true;

include_once($_SERVER['DOCUMENT_ROOT'] ."/include/user/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/tucao/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/mblog/inc.php");
	

	

	$sql = "select count(*) as count from qq_user_info where count_mblog > 0";
	$db_base = new db_base();
	$count = $db_base->select($sql);
	$count = $count[0]["count"];
	echo "tag_count:$count<br>\n";
	$total_page = ceil($count/1000);
	
	echo "page:$total_page";
	
	for($i=1;$i<=$total_page;$i++)
	{
		get_list_by_page($i);
	}
	
	function get_list_by_page($p)
	{
		$user_info = new user_info();
		$start = ($p-1)*1000;
		$db_mblog_cron_topic_tag = new db_mblog_cron_topic_tag();
		$sql = "select * from qq_user_info where count_mblog > 0 limit  $start,1000" ;
		
		$db_base = new db_base();
		$list = $db_base->select($sql);
		
		$uid_array = array();
		foreach($list as $value)
		{
			$uid = $value["uid"];
			$user_info->update_user_mblog_count_and_main_topic($uid,$value);
		}
	}

